package com.etone.web.controller.system;

import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.etone.common.annotation.Log;
import com.etone.common.core.controller.BaseController;
import com.etone.common.core.domain.AjaxResult;
import com.etone.common.enums.BusinessType;
import com.etone.system.domain.SysArrange;
import com.etone.system.service.ISysArrangeService;
import com.etone.common.utils.poi.ExcelUtil;
import com.etone.common.core.page.TableDataInfo;

/**
 * 排Controller
 * 
 * @author etone
 * @date 2025-05-27
 */
@RestController
@RequestMapping("/system/arrange")
public class SysArrangeController extends BaseController
{
    @Autowired
    private ISysArrangeService sysArrangeService;

    /**
     * 查询排列表
     */
    @PreAuthorize("@ss.hasPermi('system:arrange:list')")
    @GetMapping("/list")
    public TableDataInfo list(SysArrange sysArrange)
    {
        startPage();
        List<Map<String,Object>> list = sysArrangeService.selectSysArrangeList(sysArrange);
        return getDataTable(list);
    }


    /**
     * 获取排详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:arrange:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(sysArrangeService.selectSysArrangeById(id));
    }

    /**
     * 新增排
     */
    @PreAuthorize("@ss.hasPermi('system:arrange:add')")
    @Log(title = "排", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SysArrange sysArrange)
    {
        return toAjax(sysArrangeService.insertSysArrange(sysArrange));
    }

    /**
     * 修改排
     */
    @PreAuthorize("@ss.hasPermi('system:arrange:edit')")
    @Log(title = "排", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SysArrange sysArrange)
    {
        return toAjax(sysArrangeService.updateSysArrange(sysArrange));
    }

    /**
     * 删除排
     */
    @PreAuthorize("@ss.hasPermi('system:arrange:remove')")
    @Log(title = "排", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(sysArrangeService.deleteSysArrangeByIds(ids));
    }
}
